server bug fix: remove network details when network is removed#5675
server bug fix: remove network details when network is removed#5675weizhouapache merged 2 commits intoapache:4.16from
Conversation
| if (networkAccount != null) { | ||
| _networkAccountDao.remove(networkAccount.getId()); | ||
| } | ||
| // Remove network details |
There was a problem hiding this comment.
I don't think this comment is needed, given the name of the method invoked
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖️ el7 ✖️ el8 ✖️ debian ✔️ suse15. SL-JID 1724 |
|
@blueorangutan package |
|
@weizhouapache a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✖️ el8 ✔️ debian ✔️ suse15. SL-JID 1735 |
GutoVeronezi
left a comment
There was a problem hiding this comment.
Code LTGM, I did not test it though.
|
@blueorangutan package |
|
@rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 1770 |
|
@blueorangutan package |
|
@sureshanaparti a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 1777 |
|
@blueorangutan test centos7 vmware-67u3 |
|
@rhtyd a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests |
| _networkAccountDao.remove(networkAccount.getId()); | ||
| } | ||
|
|
||
| networkDetailsDao.removeDetails(networkFinal.getId()); |
There was a problem hiding this comment.
The foreign key should serve the purpose here. But, when a network is destroyed, the removed date is set, and the record is not removed from the table (to keep/track the history at later stage when needed). The same is the case with most of the resources, where the foreign key is set with 'ON DELETE CASCADE' but unused. May be, a cleanup (enabled/disabled) for all such removed entires from the DB, have to be introduced at regular intervals (that can be set using global config).
CONSTRAINT `fk_network_details__network_id` FOREIGN KEY `fk_network_details__network_id`(`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE
There was a problem hiding this comment.
@sureshanaparti
yes, you are absolutely right. ON DELETE CASCADE does not work as expected because cloudstack updates removed field instead deleting the record from DB.
|
travis failures are not related to this pr and |
|
Trillian test result (tid-2580)
|
|
Merged based on 3 approvals and trillian test result. |
Description
This PR removes network details when network is removed.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?